﻿using HKB.Common;
using HKB.Web.Admin;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;

public partial class Admin_Admin_AddInterface : Admin, IRequiresSessionState
{
    protected DefaultProfile profile
    {
        get
        {
            return (DefaultProfile)this.Context.Profile;
        }
    }
    protected global_asax applicationInstance
    {
        get
        {
            return (global_asax)this.Context.ApplicationInstance;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!base.IsPostBack)
        {
            if (!base.admin.CheckAdminPower(4))
            {
                base.WriteLog("Modify", Language.GetAdminMsg("Log/Access", "0"), "Interface");
                base.WriteRightErrMsg();
            }
        }
        string a = Fetch.Get("Action");
        if (a == "Add")
        {
            this.FormView1.DefaultMode = FormViewMode.Insert;
        }
        TextBox textBox = (TextBox)this.FormView1.FindControl("UpdateTime");
        textBox.Attributes.Add("onClick", string.Concat(new string[]
		{
			"show_cele_date(",
			textBox.UniqueID,
			",'','',",
			textBox.UniqueID,
			");"
		}));
    }
    protected void ObjectDataSource1_Init1(object sender, EventArgs e)
    {
        base.Response.Cache.SetNoStore();
    }
    protected void ResponseToFatherWindow()
    {
        string s = "<script type='text/javascript' language='javascript'>\r\n                                window.returnValue=true;\r\n                                window.close();\r\n                                parent.howave_main.location = 'Admin_InterfaceManage.aspx';\r\n                             </script>";
        base.Response.Write(s);
    }
    protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
    {
        this.ResponseToFatherWindow();
    }
    protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {
        this.ResponseToFatherWindow();
    }
    protected void FormView1_ItemUpdating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        TextBox textBox = (TextBox)this.FormView1.FindControl("AdminLoginPass");
        string text = textBox.Text;
        if (text == "" || text == null)
        {
            text = "";
        }
        else
        {
            text = this.Md5(text, 32);
        }
        e.InputParameters["AdminLoginPassword"] = text;
    }
    protected void ReplacePassWord(object sender, EventArgs e)
    {
        TextBox textBox = (TextBox)this.FormView1.FindControl("AdminLoginPass");
        textBox.Text = "";
    }
}
